import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import StartView from '../views/StartView.vue'
import HomeView from '../views/HomeView.vue'
import HelpView from '../views/HelpView.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'start',
    component: StartView
  },
  {
    path: '/',
    name: 'home',
    component: HomeView,
    children: [
      {
        path: '/home',
        component: () => import('../components/HomeComponent.vue')
      },
      {
        path: '/login',
        component: () => import('../components/LoginComponent.vue')
      },
      {
        path: '/register',
        component: () => import('../components/RegisterComponent.vue')
      },
      {
        path: '/category/:categoryId',
        component: () => import('../components/CategoryDetailComponent.vue')
      }
    ]
  },
  {
    path: '/help',
    name: 'help',
    component: HelpView
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
